import serial

port = serial.Serial(port='//./COM25', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=0.1)

while True:
    response = port.readall()    
    port.write(response)
    print(response)
    #Sleep(0.1)
    
##    # 发送指令的完整流程
##    def send_cmd(self, cmd):
##        self.port.write(cmd)
##        response = self.port.readall()
##        response = self.convert_hex(response)
##        return response
##
##    # 转成16进制的函数
##    def convert_hex(self, string):
##        res = []
##        result = []
##        for item in string:
##            res.append(item)
##        for i in res:
##            result.append(hex(i))
##        return result
